/*
 * rdesktop.h
 *
 *  Created on: Oct 12, 2011
 *      Author: welcome
 */

#ifndef RDESKTOP_H_
#define RDESKTOP_H_
#include <types.h>
#ifdef __cplusplus
extern "C" {
#endif

/* standard exit codes */
#ifndef EX_OK
#define EX_OK           0
#endif
#ifndef EX_USAGE
#define EX_USAGE        64
#endif
#ifndef EX_DATAERR
#define EX_DATAERR      65
#endif
#ifndef EX_NOINPUT
#define EX_NOINPUT      66
#endif
#ifndef EX_NOUSER
#define EX_NOUSER       67
#endif
#ifndef EX_NOHOST
#define EX_NOHOST       68
#endif
#ifndef EX_UNAVAILABLE
#define EX_UNAVAILABLE  69
#endif
#ifndef EX_SOFTWARE
#define EX_SOFTWARE     70
#endif
#ifndef EX_OSERR
#define EX_OSERR        71
#endif
#ifndef EX_OSFILE
#define EX_OSFILE       72
#endif
#ifndef EX_CANTCREAT
#define EX_CANTCREAT    73
#endif
#ifndef EX_IOERR
#define EX_IOERR        74
#endif
#ifndef EX_TEMPFAIL
#define EX_TEMPFAIL     75
#endif
#ifndef EX_PROTOCOL
#define EX_PROTOCOL     76
#endif
#ifndef EX_NOPERM
#define EX_NOPERM       77
#endif
#ifndef EX_CONFIG
#define EX_CONFIG       78
#endif

#ifdef WITH_DEBUG
#define DEBUG(args)	printf args;
#else
#define DEBUG(args)
#endif

#ifdef WITH_DEBUG_KBD
#define DEBUG_KBD(args) printf args;
#else
#define DEBUG_KBD(args)
#endif

#ifdef WITH_DEBUG_RDP5
#define DEBUG_RDP5(args) printf args;
#else
#define DEBUG_RDP5(args)
#endif

#ifdef WITH_DEBUG_CLIPBOARD
#define DEBUG_CLIPBOARD(args) printf args;
#else
#define DEBUG_CLIPBOARD(args)
#endif

#ifdef WITH_DEBUG_SOUND
#define DEBUG_SOUND(args) printf args;
#else
#define DEBUG_SOUND(args)
#endif

#ifdef WITH_DEBUG_CHANNEL
#define DEBUG_CHANNEL(args) printf args;
#else
#define DEBUG_CHANNEL(args)
#endif

#ifdef WITH_DEBUG_SCARD
#define DEBUG_SCARD(args) printf args;
#else
#define DEBUG_SCARD(args)
#endif

#ifndef MIN
#define MIN(x,y)		(((x) < (y)) ? (x) : (y))
#endif

#ifndef MAX
#define MAX(x,y)		(((x) > (y)) ? (x) : (y))
#endif

extern void warning(const char *format, ...);
extern void unimpl(const char *format, ...);
extern void error(const char *format, ...);
extern int load_licence(unsigned char **data);
extern void save_licence(unsigned char *data, int length);
extern void generate_random(uint8 * random);
extern int rd_lseek_file(int fd, int offset);
extern void rd_close_file(int fd);
extern int rd_open_file(char *filename);
extern int rd_read_file(int fd, void *ptr, int len);
extern int rd_write_file(int fd, void *ptr, int len);
extern RD_BOOL rd_lock_file(int fd, int start, int len);
extern RD_BOOL rd_pstcache_mkdir(void);
extern char *next_arg(char *src, char needle);
extern int fnmatch(const char *pattern, const char *string, int flags);
extern char * l_to_a(long N, int base);
extern void toupper_str(char *p);
extern void parse_server_and_port(char *server);
extern void rdesktop_reset_state(void);
extern void print_disconnect_reason(uint16 reason);

extern int g_sizeopt;
extern int g_width;
extern int g_height;
extern int g_xpos;
extern int g_ypos;
extern int g_pos;
extern RD_BOOL g_sendmotion;
extern RD_BOOL g_fullscreen;
extern RD_BOOL g_grab_keyboard;
extern RD_BOOL g_hide_decorations;
extern RD_BOOL g_pending_resize;
extern char g_title[64];
extern int g_server_depth;
extern int g_win_button_size;
extern char g_hostname[16];
extern RD_BOOL g_bitmap_cache;
extern RD_BOOL g_ownbackstore;
extern RD_BOOL g_encryption;
extern RD_BOOL g_packet_encryption;
extern RD_BOOL g_owncolmap;
extern RD_BOOL g_numlock_sync;
extern int g_server_bpp;
extern uint32 g_rdp5_performanceflags;
extern RD_BOOL g_bitmap_cache_persist_enable;
extern char *g_rdpdr_clientname;
extern RD_BOOL g_console_session;
extern RD_BOOL g_use_rdp5;
extern RD_BOOL packet_encryption;
extern RD_BOOL g_redirect;
extern char  g_redirect_domain[16];
extern char*  g_redirect_username;
extern char g_redirect_password[64];
extern char g_redirect_server[64];
extern uint32 g_embed_wnd;
extern char keymapname[16];
extern uint32 g_num_devices;
extern char *g_username;


#ifdef __cplusplus
}
#endif

#endif /* RDESKTOP_H_ */
